﻿

using LxBasic;


namespace LxCore
{
    public partial class ZoneCFDFields
    {
        protected TurbulencekOmega kw;
        public void CheckCreate_kw()
        {
            if (WallDistance != null && PhysicalModel.TurbulenceType == TurbulenceTypes.k_Omega)
            {
                LxBasic.CheckCreator.Instance(ref kw, out TurbulencekOmega kwnew);
                kw.CheckCreate(Zone);
                //LxSim.Sim.Solvers.TurbulenceGroup.EquationsStorage.Add(kw);
                //LxSim.Sim.Solvers.InitializeGroup.Initializations.Add(kw);
            }
            else
            {
                kw = null;
            }
        }

        public void SetParameter_kw()
        {
            if (kw == null) return;
            throw new NotImplementedException();
            //kw.SetZone_Main(Velocity, GammaCommon, Density, WallDistance, PhysicalModel.TurbBoundType);
            //kw.SetZone_kwEquation_ByTurbIntenAndVisRate(ConstField.Double0, ConstField.Double0, PhysicalModel.InitialTurbIntensity,
            //    PhysicalModel.InitialTurbVelRef, PhysicalModel.TurblenceRelaxFactor,
            //    PhysicalModel.TurbulenceConvScheme, 1e-10,
            //    new ConstField.Double(0), ConstField.Double0, PhysicalModel.InitialTurbVisRate,
            //    PhysicalModel.TurblenceRelaxFactor, PhysicalModel.TurbulenceConvScheme, 1e-10);
            //if (T != null)
            //{
            //    kw.SetZone_part3_TemperatureGamma(true, SpecificHeat, ThermalConductivity);
            //}
            //else
            //{
            //    kw.SetZone_part3_TemperatureGamma(false, null, null);
            //}
            //if (LxSim.Sim.PhysicalModels.TimeType == TimeDiscreteTypes.Steady)
            //{
            //    kw.k.SetZone_TransTerm(false, null, null);
            //    kw.w.SetZone_TransTerm(false, null, null);
            //}
            //else
            //{
            //    kw.k.SetZone_TransTerm(true, ConstField.Double1, Density);
            //    kw.w.SetZone_TransTerm(true, ConstField.Double1, Density);
            //    LxSim.Sim.SolveCenter.InitializeGroup.Initializations.Add(kw.k.TransData);
            //    LxSim.Sim.SolveCenter.InitializeGroup.Initializations.Add(kw.w.TransData);
            //}
            //foreach (var t in Zone.Bounds)
            //{
            //    var bset = ZoneSet.BoundSets[t.ID];// t.CFDSetting;
            //    switch (bset.BoundType)
            //    {
            //        case BoundTypes.Wall:
            //        case BoundTypes.Symmetry:
            //            kw.SetBound_WallOrSymmetry(t);
            //            break;
            //        case BoundTypes.VelocityInlet:
            //        case BoundTypes.PressureInOut:
            //            kw.SetBound_Flow_ByTurbIntenAndVisRate(bset.TurbIntensity, bset.TurbVisRate, t);
            //            break;
            //        default:
            //            LxLog.Error("未知边界类型");
            //            break;
            //    }
            //}
        }

    }
}


//SolverControl.SIMPLEGroup.Addkew(zone, zone.AMGSolver, kw);
